import React, { Component } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as actions from '../../actions'

class Detail extends Component {
    render() {
        let { item } = this.props
        return (
            <div>
                <div>
                    <img src={item.img} alt='' />
                    <p>{item.name}</p>
                    <p>单价：{item.price}</p>
                </div>
            </div>
        )
    }
}

let mapStateToProps = ({ DetailReducer }) => {
    return {
        ...DetailReducer
    }
}

let mapDispatchToProps = (dispatch) => bindActionCreators(actions, dispatch)

export default connect(mapStateToProps, mapDispatchToProps)(Detail)